#if !defined(CountHeader)
#define CountHeader

#if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 401
#define countUp(c) (__sync_add_and_fetch (&(c), 1))
#define countDown(c) (__sync_sub_and_fetch (&(c), 1))
#else
// Note that we are not thread-safe if using gcc < 4.01!
#define countUp(c) (++(c))
#define countDown(c) (--(c))
#endif

#endif
